import java.util.Scanner;

public class Mystack
{
	private Object[] mystack;
	private Integer top = -1;
	private int size;
	
	public static void main(String[] arg)
	{
		// Object mystack;
		Scanner eingabe = new Scanner(System.in);
		int size;
		System.out.println("Wie groß soll der Stack sein?");
		size = eingabe.nextInt();
		Mystack myobject = new Mystack(size);
		System.out.println("Object wird erstellt:");
		
		int intwert = 10;
		boolean boolwert = true;
		double doublewert = 1.2;
		char charwert = 'c';
		
		myobject.push(Integer.valueOf(intwert));
		myobject.push(new Character(charwert));
		myobject.push(new Double(doublewert));
		myobject.push(new Boolean(boolwert));
		
		myobject.stackPrint();		
		// myobject.stackPrint();
		
		
		myobject.push(Integer.valueOf(intwert));
		myobject.push(new Character(charwert));
		myobject.push(new Double(doublewert));
		myobject.push(new Boolean(boolwert));

		myobject.fifo();
	}
	
	public Mystack(int size)
	{
		this.size = size;
		mystack = new Object[size];
	}
		
	public void push(Object u)
	{
		top = top +1;
		mystack[top] = u;
	}
	
	public Object pop()
	{
		
		Object temp = mystack[top];
		mystack[top] = null;
		top = top-1;
		return temp;
	}
	
	public void stackPrint()
	{
		for(;top>=0;)
		{
			System.out.println("Stack["+top+"] : " + pop());
		}
	}
	
	public boolean isEmpty()
	{
		if (top == -1)
			return true;
		else
			return false;
	}			
}

	
		
		